import 'package:bluetooth_helper/utils/MessageHelper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

class SettingPage extends StatelessWidget {
  void showMsg(String msg) {
    debugPrint("[setting]:" + msg);
  }



  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    // throw UnimplementedError();
    void test1() {
      showMsg("test1");
      SmartDialog.showToast('test toast',
          displayTime: const Duration(seconds: 6));
    }

    void test2() async {
      showMsg("test2");
      SmartDialog.showLoading(msg: "正在加载!", clickMaskDismiss: true);
      await Future.delayed(const Duration(seconds: 20));
      SmartDialog.dismiss();
    }




    void test3() async{
      showMsg("test3");
      // SmartDialog.showNotify(msg: '操作成功.', notifyType: NotifyType.success,maskColor: Colors.green);
      // if(await MessageHelper.Confrim(context, "title", "message")){
      //   showMsg("confrim");
      // }else{
      //   showMsg("cancel");
      // }
      var select = <String>["交流","直流","蓝牙"];
      var selectIndex = await MessageHelper.Select(context, "简单测试", select);
      showMsg("selectIndex : ${selectIndex}");
      // showAlertDialog(context);
    }

    return Column(
      children: [
        ListTile(
          title: const Text("test1"),
          onTap: test1,
        ),
        ListTile(
          title: const Text("test2"),
          onTap: test2,
        ),
        ListTile(
          title: const Text("test3"),
          onTap: test3,
        ),
      ],
    );
  }
}
